package com.example.sls.mapper.teacher.proSet;

import com.example.sls.pojo.teacher.pro.Pro;
import com.example.sls.pojo.teacher.proSet.ProSet;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository

//对题集的操作

public interface ProSetMapper {

    @Select("select * from proset where setId = #{setId};")
    ProSet getProSetBySetId(@Param("setId") Integer setId);   //通过setId获取proSet



    @Select("select * from proset where createdBy = #{TId}")
    List<ProSet> getProSetByTId(@Param("TId") Integer TId);   //通过teacherId获取该教师创建的所有题集号

    @Select("select setId from proset where createdBy = #{TId}")
    List<Integer> getSetIdByTId(@Param("TId") Integer Tid);  //通过teacherId获取当前老师创建的所有题集的setId



    @Select("select * from proSet")
    List<ProSet> getProSetInfo();  //获取所有题集

    @Insert("insert into proset values(#{id}, #{setId}, #{createdBy}, #{createDate});")
    Integer addProSet(ProSet proset);  //(教师)添加题集

    @Select("select max(id) from proset;")
    Integer getMaxId();  //获取题集最大id

    @Select("select count(*) from proset;")
    Integer getCount();  //获取题集数量
}
